/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.gla.impl;

import de.sabram.upb.specs.gla.AuxiliaryScannerName;
import de.sabram.upb.specs.gla.GlaPackage;
import de.sabram.upb.specs.gla.Pattern;
import de.sabram.upb.specs.gla.Specification;
import de.sabram.upb.specs.gla.TokenProcessorName;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Specification</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.gla.impl.SpecificationImpl#getPattern <em>Pattern</em>}</li>
 *   <li>{@link de.sabram.upb.specs.gla.impl.SpecificationImpl#getAuxiliaryScannerName <em>Auxiliary Scanner Name</em>}</li>
 *   <li>{@link de.sabram.upb.specs.gla.impl.SpecificationImpl#getTokenProcessorName <em>Token Processor Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SpecificationImpl extends MinimalEObjectImpl.Container implements Specification
{
  /**
   * The cached value of the '{@link #getPattern() <em>Pattern</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPattern()
   * @generated
   * @ordered
   */
  protected Pattern pattern;

  /**
   * The cached value of the '{@link #getAuxiliaryScannerName() <em>Auxiliary Scanner Name</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAuxiliaryScannerName()
   * @generated
   * @ordered
   */
  protected AuxiliaryScannerName auxiliaryScannerName;

  /**
   * The cached value of the '{@link #getTokenProcessorName() <em>Token Processor Name</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTokenProcessorName()
   * @generated
   * @ordered
   */
  protected TokenProcessorName tokenProcessorName;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SpecificationImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return GlaPackage.Literals.SPECIFICATION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Pattern getPattern()
  {
    return pattern;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPattern(Pattern newPattern, NotificationChain msgs)
  {
    Pattern oldPattern = pattern;
    pattern = newPattern;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__PATTERN, oldPattern, newPattern);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPattern(Pattern newPattern)
  {
    if (newPattern != pattern)
    {
      NotificationChain msgs = null;
      if (pattern != null)
        msgs = ((InternalEObject)pattern).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__PATTERN, null, msgs);
      if (newPattern != null)
        msgs = ((InternalEObject)newPattern).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__PATTERN, null, msgs);
      msgs = basicSetPattern(newPattern, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__PATTERN, newPattern, newPattern));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AuxiliaryScannerName getAuxiliaryScannerName()
  {
    return auxiliaryScannerName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAuxiliaryScannerName(AuxiliaryScannerName newAuxiliaryScannerName, NotificationChain msgs)
  {
    AuxiliaryScannerName oldAuxiliaryScannerName = auxiliaryScannerName;
    auxiliaryScannerName = newAuxiliaryScannerName;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME, oldAuxiliaryScannerName, newAuxiliaryScannerName);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAuxiliaryScannerName(AuxiliaryScannerName newAuxiliaryScannerName)
  {
    if (newAuxiliaryScannerName != auxiliaryScannerName)
    {
      NotificationChain msgs = null;
      if (auxiliaryScannerName != null)
        msgs = ((InternalEObject)auxiliaryScannerName).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME, null, msgs);
      if (newAuxiliaryScannerName != null)
        msgs = ((InternalEObject)newAuxiliaryScannerName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME, null, msgs);
      msgs = basicSetAuxiliaryScannerName(newAuxiliaryScannerName, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME, newAuxiliaryScannerName, newAuxiliaryScannerName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TokenProcessorName getTokenProcessorName()
  {
    return tokenProcessorName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetTokenProcessorName(TokenProcessorName newTokenProcessorName, NotificationChain msgs)
  {
    TokenProcessorName oldTokenProcessorName = tokenProcessorName;
    tokenProcessorName = newTokenProcessorName;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME, oldTokenProcessorName, newTokenProcessorName);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTokenProcessorName(TokenProcessorName newTokenProcessorName)
  {
    if (newTokenProcessorName != tokenProcessorName)
    {
      NotificationChain msgs = null;
      if (tokenProcessorName != null)
        msgs = ((InternalEObject)tokenProcessorName).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME, null, msgs);
      if (newTokenProcessorName != null)
        msgs = ((InternalEObject)newTokenProcessorName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME, null, msgs);
      msgs = basicSetTokenProcessorName(newTokenProcessorName, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME, newTokenProcessorName, newTokenProcessorName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case GlaPackage.SPECIFICATION__PATTERN:
        return basicSetPattern(null, msgs);
      case GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME:
        return basicSetAuxiliaryScannerName(null, msgs);
      case GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME:
        return basicSetTokenProcessorName(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case GlaPackage.SPECIFICATION__PATTERN:
        return getPattern();
      case GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME:
        return getAuxiliaryScannerName();
      case GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME:
        return getTokenProcessorName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case GlaPackage.SPECIFICATION__PATTERN:
        setPattern((Pattern)newValue);
        return;
      case GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME:
        setAuxiliaryScannerName((AuxiliaryScannerName)newValue);
        return;
      case GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME:
        setTokenProcessorName((TokenProcessorName)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case GlaPackage.SPECIFICATION__PATTERN:
        setPattern((Pattern)null);
        return;
      case GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME:
        setAuxiliaryScannerName((AuxiliaryScannerName)null);
        return;
      case GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME:
        setTokenProcessorName((TokenProcessorName)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case GlaPackage.SPECIFICATION__PATTERN:
        return pattern != null;
      case GlaPackage.SPECIFICATION__AUXILIARY_SCANNER_NAME:
        return auxiliaryScannerName != null;
      case GlaPackage.SPECIFICATION__TOKEN_PROCESSOR_NAME:
        return tokenProcessorName != null;
    }
    return super.eIsSet(featureID);
  }

} //SpecificationImpl
